package cn.juque.abstractfactory.factory;

import cn.juque.abstractfactory.service.BydEnum;
import cn.juque.abstractfactory.service.BydPipelineService;
import cn.juque.common.exception.AppException;
import cn.juque.simplefactory.product.Car;

/**
 * @author juque
 * @version 1.0.0
 * <ul>
 *     <li>BydFactory</li>
 * </ul>
 * @date 2023-06-11 22:56:39
 **/
public class BydFactory extends BaseFactory{
    /**
     * 工厂抽象方法
     *
     * @param model 车型
     * @return Car
     */
    @Override
    Car create(String model) {
        BydPipelineService pipelineService = BydEnum.forPipeline(model);
        if (null == pipelineService) {
            throw new AppException("无法启动流水线");
        }
        return pipelineService.create();
    }
}
